package com.softpo.encryptiondemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;

public class Base64Activity extends AppCompatActivity {

    private  String data = "望长城内外惟余莽莽";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base64);

        byte[] encode = Base64.encode(data.getBytes(), Base64.DEFAULT);

        Log.d("flag", "----------------->onCreate: 使用Base64编码的内容："
                +new String(encode));

        String str = "5L2g5aW977yM5oiR5oOz6Lef5L2g6LCI6LCI5b+D";

        byte[] decode = Base64.decode(str.getBytes(), Base64.DEFAULT);

        Log.d("flag", "----------------->onCreate: 使用Base64解码的数据是： "
                +new String(decode));


    }
}
